//
// Created by alexa on 5/2/2024.
//

#include "MaintenanceCrew.h"
#include "nanoid/nanoid.h"

void MaintenanceCrew::removeSoldierId(const string &soldierId) {
    for (auto iter = soldiersIds.begin(); iter != soldiersIds.end(); iter++) {
        if (*iter == soldierId) {
            auto found = *iter;
            soldiersIds.erase(iter);
            break;
        }
    }
}

void MaintenanceCrew::addSoldierId(string soldierId) {
    soldiersIds.push_back(soldierId);
}


const vector<string> &MaintenanceCrew::getSoldiersIds() const {
    return soldiersIds;
}

MaintenanceCrew &MaintenanceCrew::operator+=(const string &soldierId) {
    addSoldierId(soldierId);
    return *this;
}

MaintenanceCrew &MaintenanceCrew::operator-=(const string &soldierId) {
    removeSoldierId(soldierId);
    return *this;
}

MaintenanceCrew::MaintenanceCrew() = default;
